package com.snow.useviewdemo.function2.gyroscope;

import android.os.Bundle;

import com.luck.picture.lib.tools.Constant;
import com.snow.img.ImageUtil;
import com.snow.useviewdemo.R;
import com.snow.useviewdemo.base.BaseActivity;
import com.snow.useviewdemo.databinding.ActivityGyroscopeTestBinding;

/**
 * Created by zhaoyingtao
 * Date: 2020/8/14
 * Describe:陀螺仪使用预览图片
 */
public class GyroscopeTestActivity extends BaseActivity<ActivityGyroscopeTestBinding> {
    public static String imgUrl = "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3252521864,872614242&fm=26&gp=0.jpg";
    private GyroscopeManager gyroscopeManager;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_gyroscope_test;
    }

    @Override
    protected void setViewData(Bundle savedInstanceState) {
        ImageUtil.imageLoad(this, imgUrl, mBinding.imageView);
        gyroscopeManager = new GyroscopeManager();
        mBinding.imageView.setGyroscopeManager(gyroscopeManager);
    }

    @Override
    protected void onResume() {
        super.onResume();
        gyroscopeManager.register(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        gyroscopeManager.unregister();
    }
}
